<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>修改客户所在地</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link href="/dist/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/dist/plugins/webuploader-0.1.5/webuploader.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=f5a12a1d">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        model-picker-input {
            opacity: 0 !important;
            top: -9999px;
            left: -9999px;
            position: absolute;
        }

        .model-picker-span {
            position: relative;
            display: block;
            outline: 0;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            border-bottom: 1px solid #ccc;
            background-color: #fff;
            color: #ccc;
            cursor: pointer;
        }

        .model-picker-span > .placeholder {
            color: #aaa;
        }

        .model-picker-span > .arrow {
            position: absolute;
            top: 50%;
            right: 8px;
            width: 10px;
            margin-top: -3px;
            height: 5px;
            background: url(../images/drop-arrow.png) -10px -25px no-repeat;
        }

        .model-picker-span.focus,
        .model-picker-span.open {
            border-bottom-color: #46A4FF;
        }

        .model-picker-span.open > .arrow {
            background-position: -10px -10px;
        }

        .model-picker-span > .title > span {
            color: #333;
            padding: 5px;
            border-radius: 3px;
        }

        .model-picker-span > .title > span:hover {
            background-color: #f1f8ff;
        }

        .model-picker-dropdown {
            position: absolute;
            width: 315px;
            left: -9999px;
            top: -9999px;
            outline: 0;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            z-index: 999999;
            display: none;
            min-width: 200px;
            margin-bottom: 20px;
            margin-top: 5px;
        }

        .model-select-wrap {
            box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
        }

        .model-select-tab {
            border-bottom: 1px solid #ccc;
            background: #f5f5f5;
            font-size: 13px;
        }

        .model-select-tab > a {
            display: inline-block;
            padding: 4px 20px;
            border-left: 1px solid #ccc;
            border-bottom: 1px solid transparent;
            color: #4D4D4D;
            text-align: center;
            outline: 0;
            text-decoration: none;
            cursor: pointer;
            font-size: 14px;
            margin-bottom: -1px;
        }

        .model-select-tab > a.active {
            background: #fff;
            border-bottom: 1px solid #fff;
            color: #46A4FF;
        }

        .model-select-tab > a:first-child {
            border-left: none;
        }

        .model-select-tab > a:last-child.active {
            border-right: 1px solid #ccc;
        }

        .model-select-content {
            width: 100%;
            min-height: 50px;
            background-color: #fff;
            padding: 5px 5px;
        }

        .model-select {
            font-size: 16px;
        }

        .model-select dl {
            line-height: 2;
            clear: both;
            padding: 3px 0;
            margin: 0;
            max-height: 200px;
            overflow-y: scroll;
        }

        .model-select dt {
            position: absolute;
            width: 2.5em;
            font-weight: 500;
            text-align: right;
            line-height: 2;
        }

        .model-select dd {
            margin-left: 0;
            line-height: 2;
        }

        .model-select.province dd {
            margin-left: 3em;
        }

        .model-select a {
            display: inline-block;
            padding: 0 10px;
            outline: 0;
            text-decoration: none;
            white-space: nowrap;
            margin-right: 2px;
            text-decoration: none;
            color: #333;
            cursor: pointer;
        }

        .model-select a:hover,
        .model-select a:focus {
            background-color: #f1f8ff;
            border-radius: 2px;
            color: #46A4FF;
        }

        .model-select a.active {
            background-color: #46A4FF;
            color: #fff;
            border-radius: 2px;
        }

        .table-detail input[type=text] {
            padding-left: 0 !important;
            text-indent: 0 !important;
        }

        td {
            color: #2a8cec;
        }

        td.td-title, td select, td .filename, td.td-module {
            color: #333;
        }

        .table-detail td {
            font-size: 16px;
            line-height: 39px;
            height: 39px;
            border-right: 1px solid #cbcbcb;
            border-bottom: 1px solid #cbcbcb;
        }

        .table-detail td.td-title {
            line-height: 1.5;
            background: #Fff;
        }

        .table-detail td.td-row3 {
            height: 70px;
            line-height: 20px;
            max-height: 70px;
            overflow: hidden;
            position: relative;
        }

        .yuying {
            position: absolute;
            right: 10px;
            bottom: 10px;
            width: 20px;
            height: 20px;
            background: url("/dist/img/yuyin.png");
            background-size: cover;
            cursor: pointer;
        }

        input {
            text-align: left !important;
        }

        .table-detail td.td-value {
            text-align: left !important;
            padding-left: 6px !important;
            font-size: 14px !important;
        }

        .table-detail td.td-value select {
            margin-left: -5px !important;
            padding-left: 0px !important;
            color: #2a8cec !important;
        }

        .btn-group-xs > .btn, .btn-xs {
            padding: 1px 5px;
            font-size: 16px;
            line-height: 1.5;
            border-radius: 3px;
        }

        .table-detail textarea {
            height: 60px;
            width: 100%;
            border: none;
            outline: none;
            -webkit-appearance: none;
            resize: none;
            line-height: 20px;
            padding-top: 2px !important;
            padding-left: 0px;
        }

        .td-row3 span {
            max-height: 60px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            /*display: -webkit-box;*/
            /*-webkit-box-orient: vertical;*/
            /*-webkit-line-clamp: 3;*/
            text-align: left;

        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .td-module td {
            color: #333;
            font-weight: bold;
        }

        .table-detail {
            border-left: 1px solid #cbcbcb;
            border-top: 1px solid #cbcbcb;
        }

        .table-detail .td-module {
            background-color: #ebebeb;
        }

        .wyui-autocomplete-panel li a {
            font-size: 12px;
        }

        .user {
            height: 30px;
            line-height: 30px;
            max-height: 30px;
            float: left;
            text-align: left;
            min-width: 32px;
            padding-left: 1px;
            overflow: hidden;
            cursor: pointer;
        }

        .jiaobiao, .jiaobiaoNew {
            position: relative;
        }

        .jiaobiao i {
            display: block;
            width: 0;
            height: 0;
            border-width: 0px 0 12px 12px;
            border-style: solid;
            border-color: transparent transparent transparent #2a8cec;
            position: absolute;
            top: 0px;
            left: 0px;
        }

        .biTian {
            position: absolute;
            left: 2px;
            top: 10px;
            color: red;
        }

        .vEdit {
            width: 100%;
            height: 100%;
            word-break: break-all;
            outline: none;
            user-select: text;
            white-space: pre-wrap;
            text-align: left;
            color: #2a8cec !important;
            font-size: 14px;
        }

        .td-row3 .vEdit span {
            color: #2a8cec !important;
            font-size: 12px;
            float: left;
        }

        .vEdit[contenteditable=true] {
            user-modify: read-write-plaintext-only;
        }

        .vEdit:empty:before {
            content: attr(placeholder);
            display: block;
            color: #ccc;
        }

        .vEdit {
            height: 100%;
            padding: 5px 0;
        }
    </style>
</head>
<body>
<iframe id="ifAttach" style="display:none"></iframe>

<section class="content" id="app" v-cloak style="padding:0px;">
    <div class="div-td-content-more"><i></i></div>
    <div class="model-picker-dropdown">
        <div class="model-select-wrap">
            <div class="model-select-tab">
                <a class="active" data-count="type">省</a><a class="" data-count="brand">市</a><a data-count="model" class="">县</a>
            </div>
            <div class="model-select-content">
                <div class="model-select type shen" data-count="type" style="display: block;">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="(item,i) in provinceList">{{item.name}}</a>
                    </dl>
                </div>
                <div class="model-select brand" data-count="province">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="(item,i) in cityList">{{item.name}}</a>
                    </dl>
                </div>
                <div class="model-select model" data-count="model">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="(item,i) in countyList">{{item.name}}</a>
                    </dl>
                </div>
            </div>
        </div>
    </div>
    <div class="center" style="overflow:auto;overflow-x:hidden;width: 100%;">
        <div class="templateStyle">
            <div class="boxItem">
                <div class="boxBoy">
                    <table class="table table-bordered text-center table-width">

                        <tr class="no-print" style="height: 29px;width: 380px;">
                            <td colspan="4" class=" no-print td-module" style="background: yellow;">基本信息</td>
                        </tr>
                        <tbody>
                        <tr>
                            <td class="tdColor td-title">*地址</td>
                            <td v-if="pageType=='edit'" colspan="3" style="text-align: left;" class="selectModel">
                                <span  style="padding-left: 4px;" v-text="showDz()==''?'请选择':showDz()">
                                </span>
                                <!--<input type="text" class="selectModel" :value="showDz()">-->
                            </td>
                        </tr>
                        <tr>
                            <td class="tdColor td-title">*对应区域</td>
                            <td class="td-value" colspan="3" style="text-align:left !important;">
                                <select v-model="regionId"
                                        style="background-color: white;color: #2a8cec;border-style:none;width:100%;outline: none;"
                                        @change="getGenZrByRegionId()">
                                    <option v-for="(item,i) in regionList" :value="item.regionId">
                                        {{item.regionName}}
                                    </option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td class="tdColor td-title">*跟踪人</td>
                            <td class="td-value" colspan="3" style="text-align:left !important; padding-left: 8px;">
                                {{genZR}}
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="clear"></div>
            </div>
        </div>

        <!--<table class="table-detail" style="width: 100%">-->

            <!--<tr v-if="isCreate==0">-->
                <!--<td class="td-title" style="width: 40%;">客户所在地</td>-->
                <!--<td class="td-value" style="width:60%;">-->
                    <!--<input type="text" class="selectModel" :value="showDz()">-->
                <!--</td>-->
            <!--</tr>-->
            <!--<tr v-else>-->
                <!--<td class="td-title" style="width: 40%;">区域经理</td>-->
                <!--<td class="td-value" style="width:60%;">-->
                    <!--<input type="text" id="customerCreateUserId" v-model="customerCreateUserName">-->
                <!--</td>-->
            <!--</tr>-->

        <!--</table>-->

        <div style="padding: 10px 0;text-align:center;">
            <input type="button" style="margin-left:20px;" value="保存" class="btn btn-primary btn-xs"
                   @click="updateCustomer()">
        </div>
    </div>
</section>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=63aed32f"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<!--&lt;!&ndash;ztree组件所需js&ndash;&gt;-->
<!--<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.all-3.5.min.js"></script>-->
<!--<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.exhide-3.5.js"></script>-->
<!--<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>-->
<!--<script type="text/javascript" src="/dist/js/pages/system/systemService.js"></script>-->
<!--<script type="text/javascript" src="/dist/js/pages/common/commonService.js"></script>-->
<!--<script type="text/javascript" src="/dist/js/pages/common/changeMoneyToChinese.js"></script>-->
<!--<script type="text/javascript" src="/dist/plugins/print/print.js"></script>-->
<!--<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>-->
<script type="text/javascript">
    function refresh() {
        var $iframe = top.findIframeByName("客户列表");
        $iframe[0].contentWindow.refresh();
        api.close();
    }
    function IsPC() {
        var userAgentInfo = navigator.userAgent;
        var Agents = ["Android", "iPhone",
            "SymbianOS", "Windows Phone",
            "iPad", "iPod"];
        var flag = true;
        for (var v = 0; v < Agents.length; v++) {
            if (userAgentInfo.indexOf(Agents[v]) > 0) {
                flag = false;
                break;
            }
        }
        return flag;
    }
    var api = frameElement.api, W = api.opener;
    Vue.component('v-edit-div', {
        props: {
            value: {
                type: String,
                default: ''
            }
        },
        data: function () {
            return {
                innerText: this.value,
                isLocked: false
            }
        },
        watch: {
            value: function () {
                console.log()
                if (!this.isLocked && !this.innerText) {
                    this.innerText = this.value;
                }
            }
        },
        methods: {
            changeText: function () {
                this.$emit('input', (this.$el.innerHTML).replace(/<[^>]+>/g, ""));
            }
        },
        template: '<div class="vEdit"  contenteditable="plaintext-only"   v-html="innerText"   @focus="isLocked = true" @blur="isLocked = false" @input="changeText"></div>'
    });
    var app = new Vue({
            el: '#app',
            data: {
                genZR: '',
                provinceList: [],
                cityList: [],
                countyList: [],
                regionList:[],
                regionId:'',
                userId: getCurrentUser().id,
                customerCreateUserName: '',
                customerCreateUserId: '',
                isCreate: $.wyui.page.urlParams.isCreate,
                selectIds: $.wyui.page.urlParams.selectIds,
                userIds: $.wyui.page.urlParams.userIds,
                key: $.wyui.page.urlParams.key,
                type: $.wyui.page.urlParams.type,
                provinceId: '省份',
                cityId: '市区',
                countyId: '县',
                itemsCom: [],
                itemsBran: [],
                itemsType: [],
                itemsMod: [],
                todayVisitCustomer: [],
                currentUser: getCurrentUser(),
                pageType: 'edit',
                isAdd: $.wyui.page.urlParams.isAdd,
                customerId: $.wyui.page.urlParams.customerId,
                customerVisit: [],
                customer: {
                    id: $.wyui.page.urlParams.customerId,
                    name: '',
                    tel: '',
                    customerType: '',
                    customerCredit: '',
                    provinceName: '',
                    cityName: '',
                    countyName: '',
                    intentionModel: '',
                    buyType: '',
                    buyDate: '',
                    wechat: '',
                    birthday: '',
                    idCard: '',
                    source: '销售来源',
                    otherCondition: '',
                    createUserId: '',
                    throwReason: '',
                    intentionFlag: '',
                    chance: '',
                    businessDate: '',
                    existingDevice: '',
                },
            },
            methods: {
                showDz: function () {
                    var html = '';
                    if (this.customer.provinceName) {
                        html += this.customer.provinceName;
                    }
                    if (this.customer.cityName != '') {
                        html += "-" + this.customer.cityName;
                    }
                    if (this.customer.countyName != '') {
                        html += "-" + this.customer.countyName;
                    }
                    return html;
                },
                hiddenDivModel: function () {
                    $("#countyIdel").hide();
                },
                getIntentionModel: function () {
                    var that = this;
                    that.customer.provinceName = $("#provinceN option:selected").text();
                    that.customer.cityName = $("#cityN option:selected").text();
                    that.customer.countyName = $("#countyN option:selected").text();
                    $("#countyIdel").hide();
                },
                getCity: function (id) {
                    var that = this;
                    $.wyui.postMethod('/intentCustomer/getForProvinceById.json', {
                        'id': id,
                        'userId': that.userId
                    }, function (r) {
                        that.cityList = r.records;
                    })
                },
                getCounty: function (id) {
                    var that = this;
                    $.wyui.postMethod('/intentCustomer/getForProvinceById.json', {
                        'id': id,
                        'userId': that.userId
                    }, function (r) {
                        console.log(r);
                        that.countyList = r.records;
                    })
                },
                getRegionByAddress: function (type) {
                    var that = this;
                    $.wyui.postMethod("/intentionCustomerManagement/getRegionByAddress.json", {
                        'provinceName': that.customer.provinceName,
                        'cityName': that.customer.cityName,
                        'countyName': that.customer.countyName
                    }, function (r) {
                        that.regionList = r;
                        if (r && r.length > 0 && type && type == '1') {
                            that.regionId = r[0].regionId
                            that.getGenZrByRegionId();
                        }
                    })
                },
                getGenZrByRegionId: function () {
                    var that = this;
                    $.wyui.postMethod("/intentionCustomerManagement/getGenZrByRegionId.json", {'regionId': that.regionId}, function (r) {
                        if (r){
                            that.genZR = r.genZR;
                        }

                    })
                },
                showDivModel: function (event) {
                    console.log(event)
                    $("#countyIdel").css({
                        "left": event.pageX,
                        "top": (event.pageY ) + "px"
                    }).show();
                },

                convertAuditFlagToName: function (flage) {
                    if (flage == 1) {
                        return "已通过";
                    }
                    else if (flage == 2) {
                        return "已驳回";
                    }
                    else if (flage == 0) {
                        return "待审核";
                    }
                    else {
                        return "-";
                    }
                },
                getBusinessDetail: function () {
                    var that = this;
                    var customerId = $.wyui.page.urlParams.customerId;

                    console.log(parent.$(".ui_title").text("商务条件预申请"))
                    window.location.href = "/page/apply/business/detail_new.html?id=0&pageType=edit&isAdd=1&customerId=" + customerId + "&modelName=" + that.customer.intentionModel;
                },
                throwD: function () {
                    var that = this;
                    $.dialog({
                        content: 'url:throw.html?customerId=' + that.customerId + "&t=" + new Date(),
                        title: '丢单情况描述',
                        width: 300,
                        height: 200,
                        max: false,
                        min: false,
                        lock: true
                    });
                },
                modelChange: function () {
                    var that = this;
                    $.wyui.postMethod('/deviceModel/getModelByModelName.json', {modelName: that.customer.intentionModel}, function (data) {
                        console.log(data);
                        if (data.length > 0) {
                            /* that.business.main.limitPrice=data[0].lowestPrice*/
                        } else {
                            alert("请输入标准的设备型号")
                        }
                    });
                },
                //日期格式限制
                isDate: function (val) {
                    var pattern = /^((19[2-9]\d{1})|(20((0[0-9])|(1[0-8]))))\-((0?[1-9])|(1[0-2]))\-((0?[1-9])|([1-2][0-9])|30|31)$/;
                    if (pattern.test(val)) {
                        var date = new Date(val);
                        var month = val.substring(val.indexOf("-") + 1, val.lastIndexOf("-"));
                        return date && (date.getMonth() + 1 == parseInt(month));
                    }
                    return false;
                },
                /*修改意向客户信息*/
                updateCustomer: function () {
                    var that = this;
                    var customerIds = "'" + that.selectIds + "'";
                    var userIds = "'" + that.userIds + "'";
                    if (that.isCreate == true) {
                        if (!that.customerCreateUserId) {
                            alert("区域经理不存在！")
                            return false;
                        }
                    }
                    $.wyui.postMethod('/allCustomerReport/updateProvinceById2.json', {
                        customerIds: customerIds,
                        userIds: userIds,
                        type: that.type,
                        key: that.key,
                        regionId:that.regionId,
                        provinceName: that.customer.provinceName,
                        cityName: that.customer.cityName,
                        countyName: that.customer.countyName,
                        isCreate: that.isCreate,
                        customerCreateUserId: that.customerCreateUserId
                    }, function (r) {
                        var records = r.records;
                        if (records == 'true') {
                            alert("保存成功");
                            parent.refresh();
                            api.close();
                        } else {
                            alert("保存失败，请重新输入");
                        }
                    });

                }
            }
            ,
            mounted: function () {
                var that = this;
                if ($.wyui.page.urlParams.isCreate == 0) {
                    /*获取省份*/
                    $.wyui.postMethod('/intentCustomer/getForProvinceById.json', {
                        'id': '0',
                        'userId': that.userId
                    }, function (r) {
                        console.log(r);
                        that.provinceList = r.records;

                    });
                }
                that.getRegionByAddress();
            }
        })
    ;
    $(function () {
        $("#customerCreateUserId").autoComplete({
            url: server.ip + urlConfig.system.user.getCosterTop10ByNameUser,
            render: function (users, panel) {
                if (users) {
                    for (var i = 0; i < users.length; i++) {
                        //只显示区域经理
                        if (users[i].roleName=='区域经理'){
                            $("<li></li>").data("autoComplete",
                                users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                                "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                                .appendTo(panel);
                        }
                    }
                }
            },
            selected: function (user) {
                app.customerCreateUserId = user.id;
                app.customerCreateUserName = user.name;
                return false;
            },
            extraParams: {createUserId: getCurrentUser().id},
            height: 210,
            width: 300
        });
    });
    $(function () {
        $("#txtParent").autoComplete({
            url: server.ip + "/weekPlan/getNameAndTel.json",
            render: function (r, panel) {
                for (var i = 0; i < r.length; i++) {
                    $("<li></li>").data("autoComplete",
                        r[i]).html("<a>" + r[i].customerName + "&nbsp;&nbsp;&nbsp;" +
                        "(" + "&nbsp;" + r[i].customerTel + ") " + "</a>")
                        .appendTo(panel);
                }
            },
            selected: function (r) {
                console.log(r);
                app.business.main.customerId = r.customerId;
                app.business.main.customerName = r.customerName;
                app.business.main.customerTel = r.customerTel;
                app.business.main.customerCredit = r.customerCredit;
                app.business.main.competitorCondition = r.competitorCondition;
                app.business.main.existingDevice = r.existingDevice;
                return false;
            },
            extraParams: {createUserId: getCurrentUser().id},
            height: 210,
            width: 300
        });
    });
</script>
<script>
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo,.lineF", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
    $(function () {
        $("body").on("click", ".selectModel", function (e) {
            if ($(".model-picker-dropdown").is(":hidden")) {
                $(".model-picker-dropdown").css({
                    "width": $(this).outerWidth() + "px",
                    "left": $(this).offset().left,
                    "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                }).show();
                e.stopPropagation();
            } else {
                $(".model-picker-dropdown").hide();
            }
        });
        $("body").on("click", ".model-select-tab a", function (e) {
            $(this).parent().find("a").removeClass("active");
            $(this).addClass("active");
            var boxName = $(this).attr("data-count");
            $(".model-select").hide();
            $(".model-select-content" + " ." + boxName).show();
        });
        $("body").on("click", ".model-select  a", function (e) {
            if ($(this).hasClass("active")) {
                return false;
            }
            $(this).parent().find("a").removeClass("active");
            var id = $(this).attr("attr-id");
            $(this).addClass("active");
            var val = $(this).text();
            if ($(this).parents(".model-select").hasClass("type")) {
                $(".model-select-tab a").removeClass("active");
                $(".model-select-tab a[data-count=brand]").addClass("active");
                $(".model-select").hide();
                app.customer.provinceName = val;
                app.customer.cityName = '';
                app.customer.countyName = '';
                app.getCity(id);
                $(".model-select-content .brand").show();

            } else if ($(this).parents(".model-select").hasClass("brand")) {
                $(".model-select-tab a").removeClass("active");
                var id = $(this).attr("attr-id");
                $(".model-select-tab a[data-count=model]").addClass("active");
                $(".model-select").hide();
                app.customer.cityName = val;
                app.customer.countyName = '';
                app.getCounty(id);
                $(".model-select-content .model").show()
            } else {
                app.customer.countyName = val;
                $(".model-picker-dropdown").hide();
                app.genZR = '';
                app.getRegionByAddress("1");
            }
        })
        $("body").on("click", ".model-picker-dropdown", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".model-picker-dropdown").hide();
        });
    });
</script>
<script>
    $('[contenteditable]').each(function () {
        // 干掉IE http之类地址自动加链接
        try {
            document.execCommand("AutoUrlDetect", false, false);
        } catch (e) {
        }

        $(this).on('paste', function (e) {
            e.preventDefault();
            var text = null;

            if (window.clipboardData && clipboardData.setData) {
                // IE
                text = window.clipboardData.getData('text');
            } else {
                text = (e.originalEvent || e).clipboardData.getData('text/plain') || prompt('在这里输入文本');
            }
            if (document.body.createTextRange) {
                if (document.selection) {
                    textRange = document.selection.createRange();
                } else if (window.getSelection) {
                    sel = window.getSelection();
                    var range = sel.getRangeAt(0);

                    // 创建临时元素，使得TextRange可以移动到正确的位置
                    var tempEl = document.createElement("span");
                    tempEl.innerHTML = "&#FEFF;";
                    range.deleteContents();
                    range.insertNode(tempEl);
                    textRange = document.body.createTextRange();
                    textRange.moveToElementText(tempEl);
                    tempEl.parentNode.removeChild(tempEl);
                }
                textRange.text = text;
                textRange.collapse(false);
                textRange.select();
            } else {
                // Chrome之类浏览器
                document.execCommand("insertText", false, text);
            }
        });
        // 去除Crtl+b/Ctrl+i/Ctrl+u等快捷键
        $(this).on('keydown', function (e) {
            // e.metaKey for mac
            if (e.ctrlKey || e.metaKey) {
                switch (e.keyCode) {
                    case 66: //ctrl+B or ctrl+b
                    case 98:
                    case 73: //ctrl+I or ctrl+i
                    case 105:
                    case 85: //ctrl+U or ctrl+u
                    case 117: {
                        e.preventDefault();
                        break;
                    }
                }
            }
        });
    });
</script>
</body>
</html>